function Dep() {
  this.subscribers = []
}
Dep.prototype.addSubscriber = function (sub) {
  this.subscribers.push(sub)
}

Dep.prototype.notify = function () {
  this.subscribers.forEach(subscriber=>subscriber.upDate())
}
function Watcher(fn) {
  this.fn = fn
}

Watcher.prototype.upDate = function () {
  this.fn();
}
var dep = new Dep()

dep.addSubscriber(new Watcher(function() {
  console.log('ok')
}))

dep.notify()

const proxy = new Proxy(target, handler);
const handler = {
  get: function (target, propKey, receiver) {
    console.log(`getting ${propKey}!`);
    return Reflect.get(target, propKey, receiver);
  },
  set: function (target, propKey, value, receiver) {
    console.log(`setting ${propKey}!`);
    return Reflect.set(target, propKey, value, receiver);
  }
}

const obj = new Proxy({}, handler)